home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Languages
/
Yerk 3.6.7
/
yerk 367
/
nuc
/
yerk.macro.txt
next >
Wrap
Text File
|
1993-05-12
|
5KB
|
294 lines
gonext macro
jmp donext(PC)
endm
cfas macro
data ]1-origin
do ]#>1
cfas ]2,]3,]4,]5,]6,]7,]8,]9
fin
endm
*
pushD0 MACRO
move.l d0,-(sp)
ENDM
*
pushD1 MACRO
move.l d1,-(sp)
ENDM
*
pushD2 MACRO
move.l d2,-(sp)
ENDM
*
popD0 MACRO
move.l (sp)+,d0
ENDM
*
popD1 MACRO
move.l (sp)+,d1
ENDM
popD2 MACRO
move.l (sp)+,d2
ENDM
*
leA0 MACRO
lea 0(a3,d7.l),a0
ENDM
*
leA1 MACRO
lea 0(a3,d7.l),a1
ENDM
*
cmp2 MACRO
cmpm.l (sp)+,(sp)+
ENDM
*
mlit MACRO
data lit-origin
data ]1
ENDM
*
; The dcode macro will build a 'code' Forth word definition.
; It must be invoked with the following parameters:
; ]1 = name field
; ]2 = 'I' if immediate, other = non-immediate
; ]3 = Label for the LINK field
; ]4 = label for name field
* want to pass label in list
*
dcode MACRO
ADJST
DO ']2'='I'
lk]4 DATA #:2-:1+$c0
ELSE
lk]4 DATA #:2-:1+$80
FIN
:1 ASC ']1'
:2
ADJST
data lk]3-origin
]4 data *+4-origin
ENDM
*
; The dcol macro will build a 'high-level' FORTH word definition.
; It must be inviked with the following parameters:
; ]1 = name field
; ]2 = 'I' if immediate, other = non-immediate
; ]3 = Label for the LINK field
; ]4 = current word label.
;
dcol macro
adjst
do ']2'='I'
lk]4 DATA #:2-:1+$c0
ELSE
lk]4 DATA #:2-:1+$80
FIN
:1 ASC ']1'
:2
ADJST
DATA lk]3-origin
]4 DATA colcode-origin
ENDM
*
scode MACRO
DATA pscode-origin
ENDM
*
; --------------------------------------
; The dval macro will create a mcfa VALUE def in the assembler.
; It must be invoked with the following parameters:
; ]1 = length of name feild
; ]2 = Label for the LINK field
; ]3 = label for name field
; ]4 = initial value
*
dval MACRO
ADJST
lk]3 DATA #:2-:1+$80
:1 ASC ']1'
:2
ADJST
DATA lk]2-origin ; RFL link field
]3 DATA dofetch-origin ; 0th CFA points to fetch runtime code
]31 DATA doincr-origin ; 1st CFA points to incr runtime code
]32 DATA dostore-origin ; 2nd CFA points to store runtime code
]39 DATA ]4 ; store offset in PFA
ENDM
; -------------------------
; The ddoes macro will simulate a <BUILDS DOES> def
; ]1 = name field
; ]2 = 'I' for immediate (not tested here)
; ]3 = Label for the LINK field
; ]4 = label for doescode
; ]5 = addr of first high-level DOES> code
ddoes MACRO
ADJST
do ']2'='I'
lk]4 DATA #:2-:1+$c0
ELSE
lk]4 DATA #:2-:1+$80
FIN
:1 ASC ']1'
:2
ADJST
DATA lk]3-origin ; RFL link field
]4 DATA doescode-origin ; CFA points to DOES> runtime code
DATA ]5-origin ; addr of first high-level DOES> code
ENDM
*
if. MACRO ; use with if-then structure
DATA bran0-origin
]1 DATA ]19-]1
ENDM
*
then. MACRO
]19
ENDM
*
eif. MACRO
DATA bran0-origin
]1 DATA ]19-]1+4
ENDM
*
else. MACRO
DATA bran-origin
]19 DATA ]191-]19
ENDM
*
ethen. MACRO
]191
ENDM
*
do. MACRO
DATA do_-origin
]1 DATA ]19-]1+4
ENDM
*
loop. MACRO
DATA loop_-origin
]19 DATA ]1-]19+4
ENDM
*
ploop. MACRO
DATA ploop_-origin
]19 DATA ]1-]19+4
ENDM
*
begin. MACRO
]1
ENDM
until. MACRO
DATA bran0-origin
]19 DATA ]1-]19
ENDM
*
again. MACRO
DATA bran-origin
]19 DATA ]1-]19
ENDM
*
repeat. MACRO
DATA bran-origin
]19 DATA ]1-]19
ENDM
*
while. MACRO
DATA bran0-origin
]191 DATA ]19-]191+4
ENDM
*
; -----------------------------------------------------
; The dcon MACRO will build a "constant" FORTH word definition
; ]1 = name field
; ]2 = Label to be used as LINK (last def's NFA label)
; ]3 = label for code field
; ]4 = long value to initialize pfa with
;
dcon MACRO ; create a new constant
ADJST
lk]3 DATA #:2-:1+$80
:1 ASC ']1'
:2
ADJST
DATA lk]2-origin ; RFL link field
]3 DATA concode-origin ; CFA points to run code for CONSTANT
DATA ]4-origin
ENDM
*
; -------------------------------------------
; Define a variable
dvar MACRO ; create a new variable
ADJST
lk]3 DATA #:2-:1+$80
:1 ASC ']1'
:2
ADJST
DATA lk]2-origin ; RFL link field
]3 DATA varcode-origin ; CFA points to run code for VARIABLE
DATA ]4-origin
ENDM
*
; -----------------------------------------------------
; The dvect MACRO will build a vector with three CFAS.
; ]1 = length of name field
; ]2 = Label to be used as LINK (last def's NFA label)
; ]3 = label for code field
; ]4 = initial value for pfa
dvect MACRO ; create a new vector
ADJST
lk]3 DATA #:2-:1+$80
:1 ASC ']1'
:2
ADJST
DATA lk]2-origin ; RFL link field
]3 DATA doexec-origin ; 0th CFA points to exec code for vector
]31 DATA dofetchv-origin ; 1st CFA points to fetch code for vector
]32 DATA dostore-origin ; 2nd CFA points to store code for vector
DATA ]4-origin
ENDM
*
; -----------------------------------------------------
; The dsvect MACRO will build a system vector
; ]1 = name field
; ]2 = Label to be used as LINK (last def's NFA label)
; ]3 = label for code field
; ]4 = offset into ...
; ]5 = default vector contents
dsvect MACRO ; create a new vector
ADJST
lk]3 DATA #:2-:1+$80
:1 ASC ']1'
:2
ADJST
DATA lk]2-origin ; RFL link field
]3 DATA dosexec-origin ; 0th CFA points to run code for sys vector
]31 DATA doputdef-origin ; 1st CFA points to putdef code for sys vec
]32 DATA doputsv-origin ; 2nd CFA points to putsv code for sys vecto
DATA ]4 ; offset into system vector table
DATA ]5-origin ; default vector contents
ENDM
*
DC.L MACRO
DATA ]1
DO ]#>1
DC.L ]2,]3,]4,]5,]6,]7,]8,]9
FIN
ENDM
*
DC.W MACRO
DATA /]1
DO ]#>1
DC.W ]2,]3,]4,]5,]6,]7,]8,]9
FIN
ENDM
*
DC.B MACRO
DATA #]1
DO ]#>1
DC.B ]2,]3,]4,]5,]6,]7,]8,]9
FIN
ENDM
*